<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('库存表列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>货位编码：</label>
                            <input type="text" name="cargoSpaceId"/>
                        </li>
                        <!--<li>-->
                        <!--<label>批号：</label>-->
                        <!--<input type="text" name="lotNo"/>-->
                        <!--</li>-->
                        <!--<li>-->
                        <!--<label>入库日期：</label>-->
                        <!--<input type="text" name="inDate"/>-->
                        <!--</li>-->

                        <li>
                            <label>物品编码：</label>
                            <input type="text" name="productId"/>
                        </li>

                        <li>
                            <label>托盘条码：</label>
                            <input type="text" name="trayCode" />
                        </li>



                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId','bootstrap-table')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId','bootstrap-table')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="stock:stock:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="stock:stock:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="stock:stock:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="stock:stock:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div id="div" class="col-sm-12 select-table table-bordered" style="height: 750px">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('stock:stock:edit')}]];
    var removeFlag = [[${@permission.hasPermi('stock:stock:remove')}]];
    var product_status = [[${@dict.getType('product_status')}]];
    var quality_status = [[${@dict.getType('quality_status')}]];
    var prefix = ctx + "stock/stock";

    $(function() {
        var options = {
            url: prefix + "/errorStockList",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            height: $("#div").height() / 1,
            modalName: "库存表",
            clickToSelect: true,//是否启用点击选中行
            uniqueId:"stockId",//表主键(用于修改和删除)
            sortName:"stockId",//必加排序 sortOrder: "asc"默认
            columns: [
                {
                    halign: 'center',
                    align:'center',
                    checkbox: true
                },


                {
                    field: 'stockId',
                    title: '库存编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'cargoSpaceId',
                    title: '货位编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'cargoSpaceName',
                    title: '货位名称',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'stockStatus',
                    title: '库存状态',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(quality_status, value);
                    }
                },
                {
                    field: 'productStatus',
                    title: '物品状态',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(product_status, value);
                    }
                },
                {
                    field: 'lotNo',
                    title: '批号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'inDate',
                    title: '入库日期',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'backDate',
                    title: '回流日期',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productGuid',
                    title: '物品guid',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'productId',
                    title: '物品编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productName',
                    title: '物品名称',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'spec',
                    title: '规格型号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'quantity',
                    title: '库存数量',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'jobId',
                    title: '作业编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'trayCode',
                    title: '托盘条码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'outQuantity',
                    title: '出库数量',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'stockinDetailId',
                    title: '入库子单编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'stockinId',
                    title: '入库单编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'inType',
                    title: '入库类型',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'inClassName',
                    title: '班组名称',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'inClassId',
                    title: '班组编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'warehouseId',
                    title: '仓库编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'classId',
                    title: '班组编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'stockSource',
                    title: '库存来源',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'stackingId',
                    title: '供应商编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'lineId',
                    title: '产线',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'type',
                    title: '类型',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    title: '操作',
                    halign: 'center',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.stockId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.stockId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>